package cn.wizzer.app.user.modules.models;

import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;

/**
 * 群
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table("group_info")
@TableIndexes({@Index(name = "INDEX_CT_AT", fields = {"ctAt"}, unique = false)})
public class GroupInfo extends BaseModel {

    @Column
    @Name
    @Comment("ID")
    @J4EIgnore
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(uu32 = true)
    private String id;

    @Column
    @Comment("群头像")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private String groupHeadPicture;

    @Column
    @Comment("群名")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String groupName;

    @Column
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @Comment("群主")
    private String masterId;


    @Column
    @ColDefine(type = ColType.BOOLEAN)
    @Comment("是否公开群")
    @Default("1")
    private boolean open;


    @Column
    @ColDefine(type = ColType.BOOLEAN)
    @Comment("非私聊群：1,私聊群：0")
    @Default("1")
    private boolean pub;


    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;

    @Column
    @Comment("最后通信时间")
    private Long lastCommunicationTime;

    @Column
    @ColDefine(type = ColType.BOOLEAN)
    @Comment("禁用状态下禁止发言")
    @Default("0")
    private boolean disabled;


    @Column
    @Comment("群人数(可手动修改)")
    @ColDefine(type = ColType.INT, width = 7)
    private Integer memberNum;


    /**
     * 群真实人数
     */
    private Integer realMemberNum;
}
